# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Maintainer: Rasmus Thomsen <oss@cogitri.dev>
pkgname=gnome-builder
pkgver=42.1
pkgrel=1
pkgdesc="Develop software for GNOME"
url="https://wiki.gnome.org/Apps/Builder"
# limited by polkit -> flatpak
arch="all !s390x !riscv64"
license="GPL-3.0-or-later"
depends="flatpak-builder py3-lxml py3-gobject3"
makedepends="
	meson
	libdazzle-dev
	libhandy1-dev
	glib-dev
	gtk+3.0-dev
	gtksourceview4-dev
	json-glib-dev
	jsonrpc-glib-dev
	pango-dev
	libpeas-dev
	webkit2gtk-dev
	libxml2-dev
	libgit2-glib-dev
	template-glib-dev
	llvm-dev
	gspell-dev
	enchant2-dev
	devhelp-dev
	glade-dev
	pcre2-dev
	gtkmm3-dev
	vte3-dev
	vala
	gobject-introspection-dev
	ctags
	clang-dev
	flatpak-dev
	libexecinfo-dev
	libportal-dev
	cmark-dev
	"
checkdepends="appstream-glib desktop-file-utils xvfb-run"
subpackages="$pkgname-dev $pkgname-lang"
source="
	https://download.gnome.org/sources/gnome-builder/${pkgver%.*}/gnome-builder-$pkgver.tar.xz
	fix-musl.patch
	"

build() {
	export LIBS="$LIBS -lexecinfo"
	abuild-meson \
		-Dplugin_sysprof=false \
		. output
	meson compile ${JOBS:+-j ${JOBS}} -C output
}

check() {
	# Increase the timeout, this can take pretty long, especially on armhf
	xvfb-run meson test -C output -t 10
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
}

sha512sums="
a04a71efb163808ed4bfc446334b8f9cabe33cd33c977c9047e4fb00042b18cf7095217b2e287a45efda863ef479fce11435a2d24d489ba1816e3f36a561244e  gnome-builder-42.1.tar.xz
ef7f75d316558e59ecb07b4fc8ef92abc51d78d6983021588546fadb57f90d971561be1f2491a2750e61e07c6d6200f3c199dab3db1060a2217ccbdb2505239e  fix-musl.patch
"
